import React, { memo, useEffect } from "react";
import { Card } from "antd";
import Attribute from "@/components/attribute/CommodityAttribute";
import { fetchAttributeThunk, IDispatch, IStore } from "@/store";
import { useDispatch, useSelector } from "react-redux";

const IndexClassify = memo(() => {
  const shopStore = useSelector((state: IStore) => state.shop);
  const dispatch = useDispatch<IDispatch>();
  useEffect(() => {
    dispatch(fetchAttributeThunk("attribute"));
  }, []);
  return (
    <Card className={"min-h-full"}>
      <Attribute
        title="attribute"
        currentTab={shopStore.commodityAttribute}
        getDate={() => dispatch(fetchAttributeThunk("attribute"))}
      ></Attribute>
    </Card>
  );
});

export default IndexClassify;
